package com.springbase.demo.controller.thymeleaf;

import com.springbase.demo.dto.People;
import lombok.extern.java.Log;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;

/**
 * @Author: flyFan
 * @Date: 2021/9/14 14:05
 * @Version: 1.0
 */
@Log
@Controller
public class ThymeleafController {
	
	@RequestMapping("/index")
	public String index(Model m){
		ArrayList<People> list = new ArrayList<>();
		list.add(People.builder().name("张三").address("河北石家庄").age(28).job("歌手").build());
		list.add(People.builder().name("李四").address("河北承德").age(18).job("学生").build());
		list.add(People.builder().name("王五").address("河北邯郸").age(21).job("外卖小哥").build());
		list.add(People.builder().name("赵柳").address("河北邢台").age(58).job("保安").build());
		m.addAttribute("peopleList",list);
		log.info(list.toString());
		return "people";
	}
}
